package com.nbsaas.boot.product.rest.resource;

import com.nbsaas.boot.product.api.apis.ProductModelApi;
import com.nbsaas.boot.product.data.entity.ProductModel;
import com.nbsaas.boot.product.api.domain.request.ProductModelRequest;
import com.nbsaas.boot.product.api.domain.response.ProductModelResponse;
import com.nbsaas.boot.product.api.domain.simple.ProductModelSimple;
import com.nbsaas.boot.product.rest.convert.ProductModelSimpleConvert;
import com.nbsaas.boot.product.rest.convert.ProductModelEntityConvert;
import com.nbsaas.boot.product.rest.convert.ProductModelResponseConvert;
import com.nbsaas.boot.product.data.repository.ProductModelRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商品规格模型-业务接口实现
*/
@Transactional
@Service
public class ProductModelResource extends BaseResource<ProductModel,ProductModelResponse, ProductModelSimple, ProductModelRequest>  implements ProductModelApi {

    @Resource
    private ProductModelRepository productModelRepository;

    @Override
    public JpaRepositoryImplementation<ProductModel, Serializable> getJpaRepository() {
        return productModelRepository;
    }

    @Override
    public Function<ProductModel, ProductModelSimple> getConvertSimple() {
        return new ProductModelSimpleConvert();
    }

    @Override
    public Function<ProductModelRequest, ProductModel> getConvertForm() {
        return new ProductModelEntityConvert();
    }

    @Override
    public Function<ProductModel, ProductModelResponse> getConvertResponse() {
        return new ProductModelResponseConvert();
    }




}


